﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.ExtendedMethod;
namespace CommonConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            /*#region 1.0
            string json = @"[{
                'Title': 'Json.NET is awesome!',
                'Author': {
                  'Name': 'James Newton-King',
                  'Twitter': '@JamesNK',
                  'Picture': '/jamesnk.png'
                },
                'Date': '2013-01-23T19:30:00',
                'BodyHtml': '&lt;h3&gt;Title!&lt;/h3&gt;\r\n&lt;p&gt;Content!&lt;/p&gt;'
              }
            ]";
            IList<BlogPost> list = Common.JsonHelper.ArryJosn2List<BlogPost>(json);
            Console.WriteLine(list.Count);
            Console.WriteLine(list[0].Title);
            Console.Read();
            #endregion
            #region 2.0
            DataTable dt = new DataTable();
            dt.Columns.Add("Title");
            dt.Columns.Add("AuthorName");
            dt.Columns.Add("AuthorTwitter");
            dt.Columns.Add("Body");
            for (int i = 0; i < 10; i++)
            {
                DataRow row =dt.NewRow();
                row["Title"] = "title"+i;
                row["AuthorName"] = "authorname"+i;
                row["AuthorTwitter"] = "authortwitter"+i;
                row["Body"] = "body"+i;
                dt.Rows.Add(row);
            }
          List<BlogPost> list=Common.DataTableHelper.Table2List<BlogPost>(dt);
          foreach (var item in list)
          {
              Console.WriteLine(item.Title);
          }
          Console.Read();
            #endregion*/
            #region 3.0
            string x = null;
            Console.WriteLine("aaaaaaaaaaaaaadbh352656sfasfasf".ReplaceEx(@"\d","!"));
            Console.WriteLine(x.ReplaceEx(@"\d", "!"));
            Console.WriteLine("sdfadf".ToIntEx());
            Console.WriteLine(x.ToIntEx());
            Console.WriteLine("100".ToIntEx());
            Console.WriteLine(x.ToIntEx());
            Console.WriteLine("100.00".ToDecimalEx());
            Console.WriteLine("100".ToDecimalEx());
            Console.Read();
            #endregion
        }
    }
    public class BlogPost
    {
        public string Title { get; set; }
        public string AuthorName { get; set; }
        public string AuthorTwitter { get; set; }
        public string Body { get; set; }
    }
}
